/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Manager.java
 *
 * Created on Oct 17, 2011, 8:32:48 PM
 */
package project;

import Utils.Helper;
import Utils.checkValidate;
import beanControl.PayInterestcontrol;
import beanControl.branchesControl;
import beanControl.interestTypeControl;
import beanControl.payOriginalControl;
import beanInfo.branches;
import beanInfo.interestType;
import beanInfo.payInteres;
import beanInfo.payOriginal;

/**
 *
 * @author lyan
 */
public class Manager extends javax.swing.JFrame {

    interestTypeControl typect = new interestTypeControl();
    interestType type = new interestType();
    String id = "";
    payOriginal payori = new payOriginal();
    payOriginalControl payorict = new payOriginalControl();
    branches bra = new branches();
    branchesControl bract = new branchesControl();
    SelectProftle SelectPro;
    payOriginal por = new payOriginal();
    payOriginalControl porict = new payOriginalControl();
     payInteres pay=new payInteres();
    PayInterestcontrol payct=new PayInterestcontrol();

    /** Creates new form Manager */
    public Manager(String id) {
        initComponents();
        loadbranhes();
        loadIntestType();
        loadPayOriginal();
        loadPayIn();


    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel3 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel2 = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel32 = new javax.swing.JLabel();
        txtTypeName = new javax.swing.JTextField();
        lblInterestTypeID = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tblInterestype = new javax.swing.JTable();
        btnAdd = new javax.swing.JButton();
        btnUpdate = new javax.swing.JButton();
        btnDeleteInterestype = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        jLabel15 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel33 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        tblPayOriginal = new javax.swing.JTable();
        jLabel6 = new javax.swing.JLabel();
        btnSelect = new javax.swing.JButton();
        txtProfile = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        txttotal = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        txtMoney = new javax.swing.JTextField();
        txtbalan = new javax.swing.JTextField();
        btnSave1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jLabel23 = new javax.swing.JLabel();
        jButton3 = new javax.swing.JButton();
        lblpayoriD = new javax.swing.JLabel();
        jPanel6 = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        jLabel16 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel34 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        tblbra = new javax.swing.JTable();
        jLabel5 = new javax.swing.JLabel();
        txtBranchName = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        txtAddress = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        txtEmail = new javax.swing.JTextField();
        btnSave = new javax.swing.JButton();
        btnupdateBra = new javax.swing.JButton();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        lblbarID = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jPanel8 = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        jLabel17 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel35 = new javax.swing.JLabel();
        jScrollPane4 = new javax.swing.JScrollPane();
        tblPayInterest = new javax.swing.JTable();
        btnSelect1 = new javax.swing.JButton();
        jLabel25 = new javax.swing.JLabel();
        txtprofilepay = new javax.swing.JTextField();
        jLabel26 = new javax.swing.JLabel();
        jLabel27 = new javax.swing.JLabel();
        txtAmount = new javax.swing.JTextField();
        jLabel28 = new javax.swing.JLabel();
        txtbalanceinter = new javax.swing.JTextField();
        txtMoneypay = new javax.swing.JTextField();
        jLabel29 = new javax.swing.JLabel();
        btninsertInter = new javax.swing.JButton();
        btnUpdatePayinter = new javax.swing.JButton();
        jLabel30 = new javax.swing.JLabel();
        lblPayInterID = new javax.swing.JLabel();
        btnDeleteinter = new javax.swing.JButton();

        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/9.jpg"))); // NOI18N

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jTabbedPane1.setTabPlacement(javax.swing.JTabbedPane.LEFT);

        jPanel2.setFont(new java.awt.Font("Tahoma", 1, 12));

        jPanel4.setBackground(new java.awt.Color(255, 255, 255));
        jPanel4.setLayout(null);

        jLabel2.setText("InterestType");
        jPanel4.add(jLabel2);
        jLabel2.setBounds(390, 440, 90, 30);

        jLabel13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/6.jpg"))); // NOI18N
        jPanel4.add(jLabel13);
        jLabel13.setBounds(0, 0, 290, 210);

        jLabel32.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icon/cash.png"))); // NOI18N
        jPanel4.add(jLabel32);
        jLabel32.setBounds(720, 10, 320, 200);
        jPanel4.add(txtTypeName);
        txtTypeName.setBounds(490, 440, 200, 30);
        jPanel4.add(lblInterestTypeID);
        lblInterestTypeID.setBounds(570, 430, 0, 0);

        tblInterestype.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        tblInterestype.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblInterestypeMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(tblInterestype);

        jPanel4.add(jScrollPane1);
        jScrollPane1.setBounds(40, 220, 980, 170);

        btnAdd.setBackground(new java.awt.Color(0, 102, 102));
        btnAdd.setForeground(new java.awt.Color(255, 255, 255));
        btnAdd.setText("Add");
        btnAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddActionPerformed(evt);
            }
        });
        jPanel4.add(btnAdd);
        btnAdd.setBounds(440, 500, 60, 30);

        btnUpdate.setBackground(new java.awt.Color(0, 102, 102));
        btnUpdate.setForeground(new java.awt.Color(255, 255, 255));
        btnUpdate.setText("Update");
        btnUpdate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnUpdateActionPerformed(evt);
            }
        });
        jPanel4.add(btnUpdate);
        btnUpdate.setBounds(530, 500, 67, 30);

        btnDeleteInterestype.setBackground(new java.awt.Color(0, 102, 102));
        btnDeleteInterestype.setForeground(new java.awt.Color(255, 255, 255));
        btnDeleteInterestype.setText("Delete");
        btnDeleteInterestype.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnDeleteInterestypeActionPerformed(evt);
            }
        });
        jPanel4.add(btnDeleteInterestype);
        btnDeleteInterestype.setBounds(610, 500, 73, 30);

        jButton4.setBackground(new java.awt.Color(0, 102, 102));
        jButton4.setForeground(new java.awt.Color(255, 255, 255));
        jButton4.setText("Reset");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });
        jPanel4.add(jButton4);
        jButton4.setBounds(700, 500, 61, 30);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icon/3.jpg"))); // NOI18N
        jPanel4.add(jLabel1);
        jLabel1.setBounds(270, 410, 100, 130);

        jLabel14.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/6.jpg"))); // NOI18N
        jPanel4.add(jLabel14);
        jLabel14.setBounds(0, 0, 290, 210);

        jLabel24.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/9.jpg"))); // NOI18N
        jPanel4.add(jLabel24);
        jLabel24.setBounds(290, 0, 440, 210);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, 1037, Short.MAX_VALUE)
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, 697, Short.MAX_VALUE)
        );

        jTabbedPane1.addTab("InterestType", new javax.swing.ImageIcon(getClass().getResource("/images/icon/12.png")), jPanel2); // NOI18N

        jPanel3.setBackground(new java.awt.Color(255, 255, 255));
        jPanel3.setFont(new java.awt.Font("Tahoma", 1, 12));
        jPanel3.setLayout(null);

        jPanel5.setLayout(null);
        jPanel3.add(jPanel5);
        jPanel5.setBounds(294, 0, 752, 0);

        jLabel15.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/6.jpg"))); // NOI18N
        jPanel3.add(jLabel15);
        jLabel15.setBounds(0, 0, 290, 210);

        jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/9.jpg"))); // NOI18N
        jPanel3.add(jLabel4);
        jLabel4.setBounds(290, 0, 440, 210);

        jLabel33.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icon/cash.png"))); // NOI18N
        jPanel3.add(jLabel33);
        jLabel33.setBounds(720, 10, 320, 200);

        tblPayOriginal.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        tblPayOriginal.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblPayOriginalMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(tblPayOriginal);

        jPanel3.add(jScrollPane2);
        jScrollPane2.setBounds(40, 220, 990, 180);

        jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/9.jpg"))); // NOI18N
        jPanel3.add(jLabel6);
        jLabel6.setBounds(290, 0, 440, 210);

        btnSelect.setText("Select");
        btnSelect.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSelectActionPerformed(evt);
            }
        });
        jPanel3.add(btnSelect);
        btnSelect.setBounds(750, 460, 80, 30);

        txtProfile.setEnabled(false);
        jPanel3.add(txtProfile);
        txtProfile.setBounds(500, 460, 230, 30);

        jLabel18.setFont(new java.awt.Font("Tahoma", 1, 24));
        jLabel18.setForeground(new java.awt.Color(255, 51, 0));
        jLabel18.setText("insert PayOriginal");
        jPanel3.add(jLabel18);
        jLabel18.setBounds(490, 410, 250, 30);

        jLabel19.setText("ProfileID");
        jPanel3.add(jLabel19);
        jLabel19.setBounds(410, 460, 80, 30);

        jLabel20.setText("totalAmount");
        jPanel3.add(jLabel20);
        jLabel20.setBounds(410, 510, 70, 30);

        txttotal.setEnabled(false);
        jPanel3.add(txttotal);
        txttotal.setBounds(500, 510, 230, 30);

        jLabel21.setText("PrincipalBalance");
        jPanel3.add(jLabel21);
        jLabel21.setBounds(410, 560, 80, 40);

        jLabel22.setText("Money");
        jPanel3.add(jLabel22);
        jLabel22.setBounds(410, 600, 50, 30);
        jPanel3.add(txtMoney);
        txtMoney.setBounds(500, 600, 230, 30);
        jPanel3.add(txtbalan);
        txtbalan.setBounds(500, 560, 230, 30);

        btnSave1.setText("Insert");
        btnSave1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSave1ActionPerformed(evt);
            }
        });
        jPanel3.add(btnSave1);
        btnSave1.setBounds(477, 653, 90, 30);

        jButton2.setText("Update");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });
        jPanel3.add(jButton2);
        jButton2.setBounds(590, 653, 90, 30);

        jLabel23.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icon/231.jpg"))); // NOI18N
        jPanel3.add(jLabel23);
        jLabel23.setBounds(160, 410, 220, 280);

        jButton3.setText("Delete");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });
        jPanel3.add(jButton3);
        jButton3.setBounds(690, 653, 70, 30);
        jPanel3.add(lblpayoriD);
        lblpayoriD.setBounds(420, 420, 0, 0);

        jTabbedPane1.addTab("PayOriginal", new javax.swing.ImageIcon(getClass().getResource("/images/icon/3232.jpg")), jPanel3); // NOI18N

        jPanel7.setBackground(new java.awt.Color(255, 255, 255));
        jPanel7.setLayout(null);

        jLabel16.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/6.jpg"))); // NOI18N
        jPanel7.add(jLabel16);
        jLabel16.setBounds(0, -20, 290, 210);

        jLabel7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/9.jpg"))); // NOI18N
        jPanel7.add(jLabel7);
        jLabel7.setBounds(290, 0, 440, 200);

        jLabel34.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icon/cash.png"))); // NOI18N
        jPanel7.add(jLabel34);
        jLabel34.setBounds(680, 0, 320, 200);

        tblbra.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        tblbra.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblbraMouseClicked(evt);
            }
        });
        jScrollPane3.setViewportView(tblbra);

        jPanel7.add(jScrollPane3);
        jScrollPane3.setBounds(30, 210, 980, 160);

        jLabel5.setText("BranchName");
        jPanel7.add(jLabel5);
        jLabel5.setBounds(370, 440, 70, 30);
        jPanel7.add(txtBranchName);
        txtBranchName.setBounds(450, 440, 230, 30);

        jLabel9.setText("Address");
        jPanel7.add(jLabel9);
        jLabel9.setBounds(370, 490, 70, 30);
        jPanel7.add(txtAddress);
        txtAddress.setBounds(450, 490, 230, 30);

        jLabel10.setText("Email");
        jPanel7.add(jLabel10);
        jLabel10.setBounds(370, 530, 50, 20);
        jPanel7.add(txtEmail);
        txtEmail.setBounds(450, 530, 230, 30);

        btnSave.setBackground(new java.awt.Color(0, 102, 102));
        btnSave.setFont(new java.awt.Font("Tahoma", 1, 14));
        btnSave.setForeground(new java.awt.Color(255, 255, 255));
        btnSave.setText("insert");
        btnSave.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSaveActionPerformed(evt);
            }
        });
        jPanel7.add(btnSave);
        btnSave.setBounds(420, 580, 80, 30);

        btnupdateBra.setBackground(new java.awt.Color(0, 102, 102));
        btnupdateBra.setFont(new java.awt.Font("Tahoma", 1, 14));
        btnupdateBra.setForeground(new java.awt.Color(255, 255, 255));
        btnupdateBra.setText("Update");
        btnupdateBra.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnupdateBraActionPerformed(evt);
            }
        });
        jPanel7.add(btnupdateBra);
        btnupdateBra.setBounds(510, 580, 90, 30);

        jLabel11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icon/2.jpg"))); // NOI18N
        jPanel7.add(jLabel11);
        jLabel11.setBounds(110, 380, 220, 260);

        jLabel12.setFont(new java.awt.Font("Tahoma", 0, 36));
        jLabel12.setForeground(new java.awt.Color(255, 0, 0));
        jLabel12.setText("Insert Branches");
        jPanel7.add(jLabel12);
        jLabel12.setBounds(430, 370, 260, 70);
        jPanel7.add(lblbarID);
        lblbarID.setBounds(110, 460, 0, 0);

        jButton1.setBackground(new java.awt.Color(0, 153, 153));
        jButton1.setFont(new java.awt.Font("Tahoma", 1, 14));
        jButton1.setForeground(new java.awt.Color(255, 255, 255));
        jButton1.setText("delete");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jPanel7.add(jButton1);
        jButton1.setBounds(610, 580, 80, 30);

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, 1027, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel7, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 697, Short.MAX_VALUE)
        );

        jTabbedPane1.addTab("Branches", new javax.swing.ImageIcon(getClass().getResource("/images/icon/add.jpg")), jPanel6); // NOI18N

        jPanel9.setBackground(new java.awt.Color(255, 255, 255));
        jPanel9.setLayout(null);

        jLabel17.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/6.jpg"))); // NOI18N
        jPanel9.add(jLabel17);
        jLabel17.setBounds(0, 0, 290, 210);

        jLabel8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/9.jpg"))); // NOI18N
        jPanel9.add(jLabel8);
        jLabel8.setBounds(290, 0, 440, 210);

        jLabel35.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icon/cash.png"))); // NOI18N
        jPanel9.add(jLabel35);
        jLabel35.setBounds(680, 10, 320, 200);

        tblPayInterest.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        tblPayInterest.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblPayInterestMouseClicked(evt);
            }
        });
        jScrollPane4.setViewportView(tblPayInterest);

        jPanel9.add(jScrollPane4);
        jScrollPane4.setBounds(50, 230, 970, 170);

        btnSelect1.setText("Select");
        btnSelect1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSelect1ActionPerformed(evt);
            }
        });
        jPanel9.add(btnSelect1);
        btnSelect1.setBounds(750, 470, 80, 23);

        jLabel25.setFont(new java.awt.Font("Tahoma", 1, 24));
        jLabel25.setForeground(new java.awt.Color(255, 0, 0));
        jLabel25.setText("Insert PayInterest");
        jPanel9.add(jLabel25);
        jLabel25.setBounds(490, 410, 240, 30);

        txtprofilepay.setEnabled(false);
        jPanel9.add(txtprofilepay);
        txtprofilepay.setBounds(510, 460, 220, 30);

        jLabel26.setText("ProfileID");
        jPanel9.add(jLabel26);
        jLabel26.setBounds(420, 460, 80, 30);

        jLabel27.setText("TotalAmount");
        jPanel9.add(jLabel27);
        jLabel27.setBounds(420, 510, 70, 20);

        txtAmount.setEnabled(false);
        jPanel9.add(txtAmount);
        txtAmount.setBounds(510, 500, 220, 30);

        jLabel28.setText("BalanceInterest");
        jPanel9.add(jLabel28);
        jLabel28.setBounds(420, 540, 80, 40);
        jPanel9.add(txtbalanceinter);
        txtbalanceinter.setBounds(510, 540, 220, 30);
        jPanel9.add(txtMoneypay);
        txtMoneypay.setBounds(510, 580, 220, 30);

        jLabel29.setText("Money");
        jPanel9.add(jLabel29);
        jLabel29.setBounds(420, 580, 50, 30);

        btninsertInter.setBackground(new java.awt.Color(0, 102, 102));
        btninsertInter.setForeground(new java.awt.Color(255, 255, 255));
        btninsertInter.setText("Insert");
        btninsertInter.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btninsertInterActionPerformed(evt);
            }
        });
        jPanel9.add(btninsertInter);
        btninsertInter.setBounds(500, 640, 70, 30);

        btnUpdatePayinter.setBackground(new java.awt.Color(0, 102, 102));
        btnUpdatePayinter.setForeground(new java.awt.Color(255, 255, 255));
        btnUpdatePayinter.setText("Update");
        btnUpdatePayinter.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnUpdatePayinterActionPerformed(evt);
            }
        });
        jPanel9.add(btnUpdatePayinter);
        btnUpdatePayinter.setBounds(590, 640, 80, 30);

        jLabel30.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icon/2.jpg"))); // NOI18N
        jPanel9.add(jLabel30);
        jLabel30.setBounds(90, 410, 240, 280);
        jPanel9.add(lblPayInterID);
        lblPayInterID.setBounds(110, 520, 0, 0);

        btnDeleteinter.setBackground(new java.awt.Color(0, 153, 153));
        btnDeleteinter.setForeground(new java.awt.Color(255, 255, 255));
        btnDeleteinter.setText("Delete");
        btnDeleteinter.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnDeleteinterActionPerformed(evt);
            }
        });
        jPanel9.add(btnDeleteinter);
        btnDeleteinter.setBounds(690, 640, 63, 30);

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, 1037, Short.MAX_VALUE)
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, 697, Short.MAX_VALUE)
        );

        jTabbedPane1.addTab("PayInterest", new javax.swing.ImageIcon(getClass().getResource("/images/icon/success.png")), jPanel8); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1197, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 702, Short.MAX_VALUE)
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    public void loadPayIn() {
        String sql = "select * from PayInterest";
        String[] header = {"Term", "PaymentDate", "ProfileID", "BalanceInterest", "Money", "Status"};
        Helper.loadDataTable(sql, tblPayInterest, header);
    }

    public void loadIntestType() {
        String sql = "select * from InterestType";
        String[] header = {"InterestTypeID", "InterrestName", "Status"};
        Helper.loadDataTable(sql, tblInterestype, header);
    }

    public void insertIntestType() {
        type.setInterrestName(txtTypeName.getText());
        type.setStatus("No");
        typect.insertInterstType(type);
        loadIntestType();
    }

    public void updateInterstType() {
        type.setInterestTypeID(Integer.parseInt(lblInterestTypeID.getText()));
        type.setInterrestName(txtTypeName.getText());
        type.setStatus("No");
        typect.updateInterstType(type);
        loadIntestType();
    }

    public void DeleteIntersType() {
        type.setInterestTypeID(Integer.parseInt(Helper.getValueTable(tblInterestype, 0).toString()));
        typect.DeleteInterstType(type);
    }

    public void loadbranhes() {
        String sql = "select * from Branches";
        String[] header = {"BranchesID", "BranchName", "Address", "Email"};
        Helper.loadDataTable(sql, tblbra, header);
    }

    public void loadPayOriginal() {
        String sql = "select * from PayOriginal";
        String[] header = {"Term", "PaymentDate", "ProfileID", "PrincipalBalance", "Money", "Status"};
        Helper.loadDataTable(sql, tblPayOriginal, header);

    }

    public void insertBranches() {
        bra.setBranchesName(txtBranchName.getText());
        bra.setAddress(txtAddress.getText());
        bra.setEmail(txtEmail.getText());
        bract.insertbranches(bra);
        loadbranhes();
        txtBranchName.setText("");
        txtAddress.setText("");
        txtEmail.setText("");
    }

    public void updatebranches() {
        bra.setBranchesID(Integer.parseInt(lblbarID.getText()));
        bra.setBranchesName(txtBranchName.getText());
        bra.setAddress(txtAddress.getText());
        bra.setEmail(txtEmail.getText());
        bract.updatebranches(bra);
        loadbranhes();

        txtBranchName.setText("");
        txtAddress.setText("");
        txtEmail.setText("");

    }

    public void deleteBra() {
        bra.setBranchesID(Integer.parseInt(Helper.getValueTable(tblbra, 0).toString()));
        bract.Deletebranches(bra);
        loadbranhes();
    }

    public void insertPayOri() {
        por.setPaymentDate(Helper.ConvertDateToString(new java.util.Date()));
        por.setProfileID(Integer.parseInt(txtProfile.getText()));
        por.setPrincipalBalance(txtbalan.getText());
        por.setMoney(txtMoney.getText());
        por.setStatus("False");
        porict.insertpayori(por);
        loadPayOriginal();
        txtProfile.setText("");
        txttotal.setText("");
        txtbalan.setText("");
        txtMoney.setText("");
    }

    public void updatePayOri() {
        por.setTerm(Integer.parseInt(lblpayoriD.getText()));
        por.setPaymentDate(Helper.ConvertDateToString(new java.util.Date()));
        por.setProfileID(Integer.parseInt(txtProfile.getText()));
        por.setPrincipalBalance(txtbalan.getText());
        por.setMoney(txtMoney.getText());
        por.setStatus("False");
        porict.updatePayOri(por);
        
        loadPayOriginal();
        txtProfile.setText("");
        txttotal.setText("");
        txtbalan.setText("");
        txtMoney.setText("");
    }
    
     public void insertPayInteres()
    {
        pay.setPaymentDate(Helper.ConvertDateToString(new java.util.Date()));
        pay.setProfile(Integer.parseInt(txtprofilepay.getText()));
        pay.setBalanceInterest(txtbalanceinter.getText());
        pay.setMoney(txtMoneypay.getText());
        pay.setStatus("No");
        payct.insertPayInteres(pay);
        loadPayIn();
    }
 public void UpdatePayInteres()
    {
        pay.setTerm(Integer.parseInt(lblPayInterID.getText()));
        pay.setPaymentDate(Helper.ConvertDateToString(new java.util.Date()));
        pay.setProfile(Integer.parseInt(txtprofilepay.getText()));      
        pay.setBalanceInterest(txtbalanceinter.getText());
        pay.setMoney(txtMoneypay.getText());
        pay.setStatus("No");
        payct.updatePayinterst(pay);
        loadPayIn();
    }
  public void deletepayinterest() {
        pay.setTerm(Integer.parseInt(Helper.getValueTable(tblPayInterest, 0).toString()));
        payct.Deletepayinteres(pay);
        loadPayIn();
    }
    
    
private void btnAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddActionPerformed
// TODO add your handling code here:
    if (txtTypeName.getText().length() == 0) {
        Helper.successMessage("Enter InterestTypeName "," wanning");

    } else {
        insertIntestType();
    }
}//GEN-LAST:event_btnAddActionPerformed

private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUpdateActionPerformed
// TODO add your handling code here:

    if (txtTypeName.getText().length() == 0) {
        Helper.successMessage("Enter InterestTypeName ", "wanning");

    } else {
        updateInterstType();
    }
}//GEN-LAST:event_btnUpdateActionPerformed

private void btnDeleteInterestypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteInterestypeActionPerformed
// TODO add your handling code here:
    DeleteIntersType();
    loadIntestType();
}//GEN-LAST:event_btnDeleteInterestypeActionPerformed

private void tblInterestypeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblInterestypeMouseClicked
// TODO add your handling code here:
    lblInterestTypeID.setText(Helper.getValueTable(tblInterestype, 0).toString());
    txtTypeName.setText(Helper.getValueTable(tblInterestype, 1).toString());
}//GEN-LAST:event_tblInterestypeMouseClicked

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
// TODO add your handling code here:
    txtTypeName.setText("");
}//GEN-LAST:event_jButton4ActionPerformed

private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed

    if (txtBranchName.getText().length() == 0) {
        Helper.successMessage("Enter Branches ", "wanning");

    } else if (txtAddress.getText().length() == 0) {
        Helper.successMessage("Enter Address ", "wanning");
    } else if (txtEmail.getText().length() == 0) {
        Helper.successMessage("Enter email ", "wanning");

    } else if (checkValidate.isEmail(txtEmail.getText()) == false) {
        Helper.successMessage("Email Invalid", null);
    } else {
        insertBranches();
    }
}//GEN-LAST:event_btnSaveActionPerformed

private void btnupdateBraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnupdateBraActionPerformed
// TODO add your handling code here:
    if (txtBranchName.getText().length() == 0) {
        Helper.successMessage("Enter Branches ", "wanning");

    } else if (txtAddress.getText().length() == 0) {
        Helper.successMessage("Enter Address ", "wanning");
    } else if (txtEmail.getText().length() == 0) {
        Helper.successMessage("Enter email ", "wanning");

    } else if (checkValidate.isEmail(txtEmail.getText()) == false) {
        Helper.successMessage("Email Invalid", null);
    } else {
        updatebranches();
    }
}//GEN-LAST:event_btnupdateBraActionPerformed

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
    deleteBra();
}//GEN-LAST:event_jButton1ActionPerformed

private void btnSelectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSelectActionPerformed
// TODO add your handling code here:
    SelectPro = new SelectProftle(null, true, txtProfile, txttotal);
    SelectPro.setVisible(true);

}//GEN-LAST:event_btnSelectActionPerformed

private void btnSave1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSave1ActionPerformed
// TODO add your handling code here:
    if (txtbalan.getText().length() == 0) {
        Helper.successMessage("Enter BalanceInteres", "wanning");
    } else if (txtMoney.getText().length() == 0) {
        Helper.successMessage("Enter money", "wanning");
    } else if (checkValidate.checkFloatNumber(txtbalan.getText()) == false) {
        Helper.successMessage("PrincipalBalance is number", "wanning");
    } else if (checkValidate.checkFloatNumber(txtMoney.getText()) == false) {
        Helper.successMessage("Money is number", "wanning");
    } else {
        insertPayOri();
    }
}//GEN-LAST:event_btnSave1ActionPerformed

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:

    if (txtbalan.getText().length() == 0) {
        Helper.successMessage("Enter BalanceInteres", "wanning");
    } else if (txtMoney.getText().length() == 0) {
        Helper.successMessage("Enter money", "wanning");
    } else if (checkValidate.checkFloatNumber(txtbalan.getText()) == false) {
        Helper.successMessage("PrincipalBalance is number", "wanning");
    } else if (checkValidate.checkFloatNumber(txtMoney.getText()) == false) {
        Helper.successMessage("Money is number", "wanning");
    } else {
        updatePayOri();
    }
}//GEN-LAST:event_jButton2ActionPerformed

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
    por.setTerm(Integer.parseInt(Helper.getValueTable(tblPayOriginal, 0).toString()));
    porict.Deletepayori(por);
    loadPayOriginal();
}//GEN-LAST:event_jButton3ActionPerformed

private void tblPayOriginalMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblPayOriginalMouseClicked
// TODO add your handling code here:
    lblpayoriD.setText(Helper.getValueTable(tblPayOriginal, 0).toString());
    txtProfile.setText(Helper.getValueTable(tblPayOriginal, 2).toString());
    txtbalan.setText(Helper.getValueTable(tblPayOriginal, 3).toString());
    txtMoney.setText(Helper.getValueTable(tblPayOriginal, 4).toString());
}//GEN-LAST:event_tblPayOriginalMouseClicked

private void btnSelect1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSelect1ActionPerformed
// TODO add your handling code here:
    SelectPro = new SelectProftle(null, true, txtprofilepay, txtAmount);
   SelectPro.setVisible(true);
}//GEN-LAST:event_btnSelect1ActionPerformed

private void btninsertInterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btninsertInterActionPerformed
// TODO add your handling code here:
    if(txtbalanceinter.getText().length()==0)
    {
        Helper.successMessage("Enter BalanceInteres", "wanning");
    }
    else if(txtMoneypay.getText().length()==0)
    {
        Helper.successMessage("Enter money", "wanning");
    }
    else if(checkValidate.checkFloatNumber(txtbalanceinter.getText())==false)
    {
        Helper.successMessage("balanceInteres is number","wanning");
    }
    else if(checkValidate.checkFloatNumber(txtMoneypay.getText())==false)
    {
        Helper.successMessage("Money is number","wanning");
    }
    else
    {
        insertPayInteres();
    }
    
}//GEN-LAST:event_btninsertInterActionPerformed

private void btnUpdatePayinterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUpdatePayinterActionPerformed
// TODO add your handling code here:
   if(txtbalanceinter.getText().length()==0)
    {
        Helper.successMessage("Enter BalanceInteres", "wanning");
    }
    else if(txtMoneypay.getText().length()==0)
    {
        Helper.successMessage("Enter money", "wanning");
    }
    else if(checkValidate.checkFloatNumber(txtbalanceinter.getText())==false)
    {
        Helper.successMessage("balanceInteres is number","wanning");
    }
    else if(checkValidate.checkFloatNumber(txtMoneypay.getText())==false)
    {
        Helper.successMessage("Money is number","wanning");
    }
    else
    {
       UpdatePayInteres();
    }
    
}//GEN-LAST:event_btnUpdatePayinterActionPerformed

private void tblPayInterestMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblPayInterestMouseClicked
// TODO add your handling code here:
     lblPayInterID.setText(Helper.getValueTable(tblPayInterest, 0).toString());
    txtprofilepay.setText(Helper.getValueTable(tblPayInterest, 2).toString());
    txtbalanceinter.setText(Helper.getValueTable(tblPayInterest, 3).toString());
    txtMoneypay.setText(Helper.getValueTable(tblPayInterest, 4).toString());
}//GEN-LAST:event_tblPayInterestMouseClicked

private void tblbraMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblbraMouseClicked
// TODO add your handling code here:
    lblbarID.setText(Helper.getValueTable(tblbra, 0).toString());
    txtBranchName.setText(Helper.getValueTable(tblbra,1).toString());
    txtAddress.setText(Helper.getValueTable(tblbra, 2).toString());
    txtEmail.setText(Helper.getValueTable(tblbra, 3).toString());
    
}//GEN-LAST:event_tblbraMouseClicked

private void btnDeleteinterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteinterActionPerformed
// TODO add your handling code here:
    deletepayinterest();
}//GEN-LAST:event_btnDeleteinterActionPerformed
    /**
     * @param args the command line arguments
     */
//    public static void main(String args[]) {
//        /* Set the Nimbus look and feel */
//        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
//        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
//         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
//         */
//        try {
//            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
//                if ("Nimbus".equals(info.getName())) {
//                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
//                    break;
//                }
//            }
//        } catch (ClassNotFoundException ex) {
//            java.util.logging.Logger.getLogger(Manager.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (InstantiationException ex) {
//            java.util.logging.Logger.getLogger(Manager.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (IllegalAccessException ex) {
//            java.util.logging.Logger.getLogger(Manager.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
//            java.util.logging.Logger.getLogger(Manager.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        }
//        //</editor-fold>
//
//        /* Create and display the form */
//        java.awt.EventQueue.invokeLater(new Runnable() {
//
//            public void run() {
//                new Manager().setVisible(true);
//            }
//        });
//    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAdd;
    private javax.swing.JButton btnDeleteInterestype;
    private javax.swing.JButton btnDeleteinter;
    private javax.swing.JButton btnSave;
    private javax.swing.JButton btnSave1;
    private javax.swing.JButton btnSelect;
    private javax.swing.JButton btnSelect1;
    private javax.swing.JButton btnUpdate;
    private javax.swing.JButton btnUpdatePayinter;
    private javax.swing.JButton btninsertInter;
    private javax.swing.JButton btnupdateBra;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel35;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JLabel lblInterestTypeID;
    private javax.swing.JLabel lblPayInterID;
    private javax.swing.JLabel lblbarID;
    private javax.swing.JLabel lblpayoriD;
    private javax.swing.JTable tblInterestype;
    private javax.swing.JTable tblPayInterest;
    private javax.swing.JTable tblPayOriginal;
    private javax.swing.JTable tblbra;
    private javax.swing.JTextField txtAddress;
    private javax.swing.JTextField txtAmount;
    private javax.swing.JTextField txtBranchName;
    private javax.swing.JTextField txtEmail;
    private javax.swing.JTextField txtMoney;
    private javax.swing.JTextField txtMoneypay;
    private javax.swing.JTextField txtProfile;
    private javax.swing.JTextField txtTypeName;
    private javax.swing.JTextField txtbalan;
    private javax.swing.JTextField txtbalanceinter;
    private javax.swing.JTextField txtprofilepay;
    private javax.swing.JTextField txttotal;
    // End of variables declaration//GEN-END:variables
}
